package com.example.lib.muchthread;

/**
 * 需求：简单的卖票程序
 * 多个窗口同时卖票
 */

public class e_Thread_sale_ticket_133 {
    public static void main(String[] args) {
        Ticket133 t1=new Ticket133();
        Ticket133 t2=new Ticket133();
        Ticket133 t3=new Ticket133();
        Ticket133 t4=new Ticket133();

        t1.start();
        t2.start();
        t3.start();
        t4.start();
    }
}

class Ticket133 extends Thread{

    private static int tick=100;

    @Override
    public void run() {
        while (true){
            if (tick>0){
                System.out.println(currentThread().getName()+"...sale:"+tick--);
            }
        }
    }
}
